package com.learn.controller.user;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.learn.dm.UserInfoDM;
import com.learn.service.interfaces.IUserInfoService;
import com.learn.util.SpringBeans;

@Controller
@RequestMapping("/user")
public class UserInfoController {

	/**
	 * 调用服务端dubbo服务接口返回用户表数据
	 * 
	 * @author Administrator
     * @version 1.0.0
     * @2021-06-26 09:50:12
	 * 
	 */
	@RequestMapping("/userList")
	public String findUserList(final HttpServletRequest request,
			final Model model, final HttpServletResponse response,
			@ModelAttribute("userInfoDM") final UserInfoDM dm) {
		List<UserInfoDM> tmpList = getUserInfoService().getUserInfoList(dm);
		model.addAttribute("listDM", tmpList);
		return "userList";
	}
	
	private IUserInfoService getUserInfoService(){
		return (IUserInfoService) SpringBeans
				.getBean("userInfoService");
	}

}
